<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.List"%>
<%@ page import="org.dualr.litelog.entity.Post"%>
<%@ page import="org.dualr.litelog.entity.Link"%>
<%@ page import="org.dualr.litelog.entity.Tag"%>
<%@ page import="org.dualr.litelog.entity.Comment"%>
<%@ page import="org.dualr.litelog.entity.Category"%>
<%@ page import="org.dualr.litelog.dao.CategoryDao"%>
<%@ page import="org.dualr.litelog.dao.PostDao"%>
<%@ page import="org.dualr.litelog.entity.Page"%>
<%@ page import="org.dualr.litelog.utils.LiteLogUtil"%>
<%
	String url = "";
	String title = "";
	String description = "";
	String admin = "";
	url = LiteLogUtil.getInstance().getPropsValue("/litelog.properties", "litelog.url");
	title = LiteLogUtil.getInstance().getPropsValue("/litelog.properties", "litelog.title");
	description = LiteLogUtil.getInstance().getPropsValue("/litelog.properties", "litelog.description");
	admin = LiteLogUtil.getInstance().getPropsValue("/litelog.properties", "litelog.author");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=title%></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="google,AppEngine,weisong,宋玮" name="keywords"/>
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon" />
<link href="simplestyle.css" rel="stylesheet" type="text/css" media="screen"/>
</head>
<body>
<div id="wrapper">
	<%@include file="index_header.jsp" %>
	<div id="main">
		<div id="content">
			<%
					List<Post> postList = (List<Post>)request.getAttribute("PostList");
					if (postList.size() != 0){
						for(Post post : postList){
			%>
			<div class="post">
				<h2><a href="post?method=view&id=<%=post.getId()%>" title="阅读全文"><%=post.getTitle()%></a></h2>
				<p class="meta">
				<a href="<%=url%>"><%=admin%></a> Post at <%=LiteLogUtil.getInstance().formateDate(post.getPostDate(), "yyyy/MM/dd/ a")%> | <a href="post?method=category&param=<%=post.getCategoryId()%>" title="category"><%=CategoryDao.getInstance().getNameById(post.getCategoryId())%></a> | <a href="post?method=tag&param=<%=post.getTag()%>" title="tag"><%=post.getTag()%></a>
					| <a href="post?method=view&id=<%=post.getId()%>"><%=post.getHits()%> views</a> | <a href="post?method=view&id=<%=post.getId()%>#comment_form"><%=post.getCommentCount()%> comments</a>
				</p>
				<div class="entry">
					<%=post.getContent().getValue()%>
				</div>
			</div>
			<%
					}
					Page pages = (Page)request.getAttribute("Page");
					%>
					<div id="pagination">
						<a href="post?method=<%=request.getAttribute("pageMethod")%>&param=<%=request.getAttribute("param")%>&page=<%=pages.getPrevPage()%>">上一页</a><b><%=pages.getCurPage()%>/<%=pages.getPageNum()%></b><a href="post?method=<%=request.getAttribute("pageMethod")%>&param=<%=request.getAttribute("param")%>&page=<%=pages.getNextPage()%>">下一页</a>
					</div>
					<%
				}else{
					%>
					<p style="text-align:center;">列表为空！</p>
					<%
				}
				%>
		</div>
		<div id="main-right">
						
		<div class="right-column">
			<h2>「个人简介」</h2>
			<p><a href="http://sw1982.javaeye.com">深圳|腾讯|拍拍|wei</a></p>
			<p><a href="http://sw1982.javaeye.com">我在javaeye的博客链接</a></p>
			<p>email: energy_sw AT 163.com</p>
	   </div>	
	   <div class="right-column">
		 <iframe frameborder="0" scrolling="no" src="http://v.t.qq.com/show/show.php?n=songwei&w=245&h=552&fl=2&l=8&o=29&c=0&si=2253a1720649bebf350fb49c719222134646f3df" width="245" height="552"></iframe>
	   </div>			
	   <div class="right-column">
					<h2 title="Categories">「日志分类」
					</h2>
					<ul>
						<%
							List<Category> categoryList = (List<Category>)request.getAttribute("categoryList");
							if (categoryList != null){
								for(Category category : categoryList){
						%>
						<li><img src="images/dot.gif" alt="dot" /><a href="post?method=category&param=<%=category.getId()%>"><%=category.getName()%>[<%=category.getCounts()%>]</a></li>
						<%
								}
							}
						%>
					</ul>
				</div>
				<div class="right-column">
					<h2 title="Categories">「标签TAG」</h2>
					<ul id="tag">
						<%
							List<Tag> tagList = (List<Tag>)request.getAttribute("tagList");
							if (tagList != null){
								for(Tag tag : tagList){
									%>
										<a href="post?method=tag&param=<%=tag.getTag()%>"><%=tag.getTag()%>[<%=tag.getCount()%>]</a>
									<%
								}
							}
						%>
						
					</ul>
				</div>
				<div class="right-column">
					<h2>「热门日志」</h2>
					<ul>
					<%
						List<Post> popPostList = (List<Post>)request.getAttribute("PopArticleList");
						if (popPostList != null){
							for(Post popPost : popPostList){
					%>
						<li><img src="images/dot.gif" alt="dot" /><a href="post?method=view&id=<%=popPost.getId()%>" title="<%=popPost.getTitle()%>"><%=popPost.getTitle()%></a></li>
					<%
							}
						}
					%>
					</ul>
				</div>
				<div class="right-column">
					<h2>「最新评论」</h2>
					
						<%
							List<Comment> recentCommentList = (List<Comment>)request.getAttribute("RecentCommentList");
							if (recentCommentList != null){
								for(Comment comment : recentCommentList){
						%>
						<div class="lastComment">
							<span><img src="http://www.gravatar.com/avatar/<%=LiteLogUtil.getInstance().getMD5Str(comment.getMail())%>?s=32"></img></span>
							<%
								String postTitle = PostDao.getInstance().getTitleById(comment.getPostId());
							%>
							<div><a href="post?method=view&id=<%=comment.getPostId()%>#comment-<%=comment.getId()%>" title="by:<%=comment.getAuthor()%>@<%=LiteLogUtil.getInstance().formateDate(comment.getCommentDate(), "yyyy-MM-dd a")%>"><%=comment.getAuthor()%></a> @ <a href="post?method=view&id=<%=comment.getPostId()%>#comment-<%=comment.getId()%>" title="<%=postTitle%>"><%=postTitle%></a>
							<p><%=comment.getContent().getValue()%></p>
							</div>
						</div>
						<%
								}
							}
						%>
					<p class="clear"></p>
				</div>
				<div class="right-column">
					<h2>「有趣链接」</h2>
					<ul>
						<%
							List<Link> linkList = (List<Link>)request.getAttribute("linkList");
							if (linkList != null){
								for(Link link : linkList){
						%>
						<li><img src="images/dot.gif" alt="dot" /><a href="<%=link.getUrl()%>"><%=link.getName()%></a></li>
						<%
								}
							}
						%>
					</ul>
				</div>

				
<!--				<div class="right-column">-->
<!--					<h2><a href="./rssView">「哥的RSS订阅」</a></h2>-->
<!--				</div>				-->
		</div>
		<div class="clear"></div>
	</div>
	
	<%@include file="index_footer.jsp" %>
</div>

</body>
</html>
